home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
basic
/
topmenu2.zip
/
MENU2DMO.BAS
< prev
next >
Wrap
BASIC Source File
|
1989-09-09
|
25KB
|
755 lines
'========================================================================
' Documentation For:
' Top.Menu
' Version 2.0
'
' Written By: Glenn Miller (Not The Band Leader)
' Route 8 Box 492-A
' Asheboro, North Carolina 27203
'
' On: September 5, 1989
'
'
' This Program is " ShareWare " share it, abuse it, loose-it..etc...
'
' BUT!...If you can use it...please register it by sending $15.00
' to me at the address above. Happy Trails!
'
'========================================================================
'
'Top.Menu was created as an easy means to set up a menu operated system,
'without having to deal with passing "zillions" of varables to a subroutine.
'
'It is in NO way intended to replace any of the fine utilities available
'but to be considered as a simpler (and less definable) substitute.
'
'The following program "MENU2DMO" was written using Top.Menu so you can
'see how to setup your data for Top.Menu.
'
'Okay..Enough of that..Now on to this....
'
'
'As you can see in the DECLARE statement on the 1st line of this program there
'are only 11 varables that need to be passed to the subroutine..
'
'and here they are.....
'
'
' SEL Returns containing the number of the selection that was selected.
'
' SEL$ an arry of strings containing all the menu and submenu selections
' as well as the help line (line 25)
'
' FGC ......... Fore Ground Color of the Menus (0-15)
'
' BGC ......... Back Ground Color of the Menus (0-15)
'
' HLC ......... High Lite Color of the Menus (0-31)
'
' Top.Line .... The Top starting Row Location of the Menu (0-24)
'
' Dis.Time .... A switch to Turn the Time Display On (1=on)
' Time is displayed in a 12 hr format with Am/Pm
'
' Dis.Date .... A switch to Turn the Date Display On (1=on)
'
' Scn.Blank ... A switch to enable Automatic Screen Blanking (1=on)
' When enabled, the screen will turn off if no keys
' are pressed within 3 minutes.
'
' MSG$ ........ A string that will be centered on the Top Line of the Menu.
' If MSG$="" No Message is displayed on the top line.
'
' BGC$ ........ The character thats used to clear the screen. (0-255)
'
'
'
'Heres the Details..........
'
'This Menu system is a bar type with sub menus.
'There can be up to 9 selections per sub menu.
'There can be as many Selections on the Top Bar That you can fit on it
'and these DO NOT have to be the same length.
'
'
'The KEY to this menu system is the SEL$() array.
'
'This array should be dimensioned as DIM SEL$(x,10) in the start of your
'program, Where x=number of Top Bar Selections you will have.
'
'Array SEL$(x,0) needs to contain the Selection Names For the Top Bar.
'
'Arrays SEL$(x,1) thru SEL$(x,9) contain the Selection Names For the
'sub menu under the SEL$(x,0) Name.
'
'Array SEL$(x,10) needs to contain the HELP message that will be displayed
'on line 25. (if you want one.)
'
'
'Example: To Set up a Selection called "DOS" and have 3 sub selections
' called:
'
' Exit To Dos
' Shell To Dos
' Enter Dos Commands
'
' with a Help Message of: What Do You Want!
'
'The arrays would be:
'
' SEL$(0,0)=" Dos "
' SEL$(0,1)=" Exit To Dos "
' SEL$(0,2)=" Shell To Dos "
' SEL$(0,3)=" Enter Dos Commands "
' SEL$(0,4)=""
' SEL$(0,10)="What Do You Want!"
'
'
' !!!!! NOTICE !!!!!
'
' See How SEL$(0,4)=""
'
' You MUST always define the next array AFTER the last one you want
' to use as "" (Nul), UNLESS the last one is number 9....
'
' This makes it work right!..Okay..OK
'
'
'Define all the Selections you need by this method.
'Of course you will change to the next array..ie 1,2,3...etc. instead of 0.
'
'
'
'Running Top.Menu ........
'
'Once you have setup all the SEL$() your ready to go.
'
'The Top Bar Selections can be selected by 2 different ways.....
'
' 1 - Use The Left-Right cursor Keys to move to the desired selection.
' 2 - Press the Key of the 1st letter of a selection.
'
' Note: If more than one selection has the same starting letter the
' program will move to the next selection when that same letter
' key is pressed again. I call this a "round-robin" display but I
' really dont know why.
'
'
'The Sub selections can be selected 2 different ways...
'
' 1 - Use the Up-Down cursor keys to move to the desired selection and press
' the Enter Key.
' 2 - Enter the Number of the selection.(no enter key needed)
'
'
'
'
'What you get back for all your trouble........
'
'The SEL variable returns to you with a number containing the Selection that
'was selected. (wheeeee...)
'
' If the user pressed the "Esc" Key SEL will be -1. (neg.1)
' else heres what you get.
'
'
' The number is determined by: (Top Bar Selection Number *10) + selected sub#
'
'Example: If the user selected item# 5 from the first Top Bar selection the
' number would be: 5.
'
' First Top Bar number = 0 SEL$(0,x)
'
' 0 * 10 = 0 + 5 = 5
'
'
' If item# 5 was selected from the 5th Top Bar the number would be: 45
'
' 5th Top Bar Number = 4 SEL$(4,x)
'
' 4 * 10 = 40 + 5 = 45
'
'
'
' To include the Top.Menu routine Source Code in your Program;
'
' 1st - Create/Load YOUR program into Qbasic.
' 2nd - Select "Merge..." under the "File" selection of Qbasic.
' 3rd - Select "TOPMENU2.BAS" as the File Name To Be Merged.
'
' You should now be able to "View" Top.Menu by viewing the SUBs.
'
' Example: You can Try this using the "MENU2DMO.bas".
'
' 1.- Start Quickbasic
' 2.- Load in MENU2DMO.BAS (do not load the TOPMENU2.QLB library)
' 3.- Merge TOPMENU2.BAS
' 4.- The code is now included in MENU2DMO.BAS
' 5.- Select Top.Menu in "View" SUBs
'
'
'
' Thats about it for now....so....
' Waiter!.....TOP.MENU......please!
'========================================================================
DECLARE SUB Top.Menu (sel!, sel$(), fgc!, bgc!, hlc!, topline!, dis.time!, dis.date!, scn.blank!, msg$, bgc$)
DIM sel$(9, 10) 'remember this?
'=======================================================================
' * * * * * * * * DEFINE SEL$() ARRAY WITH MENU DATA * * * * * * * * * *
'=======================================================================
'=======================================================================
'Define Top Row Selection Names (x,0)
'=======================================================================
sel$(0, 0) = " Info "
sel$(1, 0) = " Change "
sel$(2, 0) = " Dos "
sel$(3, 0) = " Set Time "
sel$(4, 0) = " HELP! "
sel$(5, 0) = " Set Date "
sel$(6, 0) = " Quit "
sel$(7, 0) = " Directory "
sel$(8, 0) = " Files "
'=======================================================================
'Define Help Messages (x,10)
'=======================================================================
sel$(0, 10) = "Display Information About TOP.MENU"
sel$(1, 10) = "Make Changes In TOP.MENU's Subroutine Program Variables"
sel$(2, 10) = "Select The Dos Function You Want To Do"
sel$(3, 10) = "Press ENTER To Set Time"
sel$(4, 10) = "Press ENTER To Display Help"
sel$(5, 10) = "Press ENTER To Set Date"
sel$(6, 10) = "Press ENTER To Quit This Demo"
sel$(7, 10) = "Select The Directory To Be Displayed"
sel$(8, 10) = "Press ENTER To Display The Files and Description"
'=======================================================================
'Define Sub Selections For Top Selection 'INFO'
'=======================================================================
sel$(0, 1) = " About The Program "
sel$(0, 2) = " How Its Used "
sel$(0, 3) = " Its' Heritage "
sel$(0, 4) = " HOW TO BUY IT! "
sel$(0, 5) = ""
'=======================================================================
'Define Sub Select